package com.haste.system.controller;

import com.haste.common.domain.po.BaseNotePo;
import com.haste.common.domain.vo.ResponseVo;
import com.haste.common.service.IBaseNoteService;
import com.haste.system.domain.vo.NoteVo;
import com.haste.system.service.INoteService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @author haste
 */
@RestController
@RequestMapping("/note")
public class NoteController {
    @Resource
    private INoteService noteService;

    @PostMapping("/insert")
    public ResponseVo insert(@RequestBody NoteVo noteVo) {
        noteService.save(noteVo);
        return new ResponseVo<>().ok();
    }

    @PutMapping("/update")
    public ResponseVo update(@RequestBody NoteVo noteVo) {
        noteService.update(noteVo);
        return new ResponseVo<>().ok();
    }

    @PostMapping("/list")
    public ResponseVo list(){
        return new ResponseVo<>(noteService.list());
    }
}
